#
#Given numRows, generate the first numRows of Pascal's triangle.
#

#@author: timlentse(tinglenxan@gmail.com)
#@Date: 2014-11-19

 # @input the the number of expected rows
 # @return a list of lists of integers
def generate(numRows):
    if numRows==0:
        return []
    elif numRows==1:
        return [[1]]
    else:
        triangleList = []
        triangleList.append([1])
        for i in xrange(numRows-1):
            tmp = []
            for j in xrange(i+2):
                if (j==0)or(j==i+1):
                    tmp.append(1)
                else: tmp.append(triangleList[i][j-1] +triangleList[i][j])
            triangleList.append(tmp)
    return triangleList
print generate(7)
   
                    
        